<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }

      a {
        text-decoration: none;
        color: black;
      }

      body {
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .container {
        width: 1400px;
        padding-bottom: 20px;
        background-color: #eee;
        padding: 20px;
      }
      .header {
        display: flex;
        justify-content: space-between;
        font-size: 17px;
        margin-bottom: 20px;
      }

      .header a:hover {
        color: #eca064;
      }
      .content {
        display: flex;
      }

      .right {
        padding-left: 20px;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        column-gap: 30px;
        row-gap: 30px;
      }

      .right a {
        display: block;
      }

      .item {
        background-color: #fff;
        height: 368px;
      }

      .item .img {
        margin-top: 20px;
      }

      .item .title {
        text-align: center;
      }

      .item .desc {
        margin: 5px 0;
        text-align: center;
        color: #cdcdcd;
        font-size: 15px;
      }

      .item .price {
        padding-top: 3px;
        font-size: 14px;
        font-weight: bold;
        text-align: center;
        color: #eca064;
      }

      .oldPrice {
        margin-left: 15px;
        color: #cdcdcd;
        text-decoration: line-through;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <div class="container">
        <div class="header">
          <div>手机</div>
          <div>
            <a href="#">查看更多</a>
          </div>
        </div>
        <div class="content">
          <div class="left">
            <a href="#">
              <img src="./imgs//ad1.png" alt="" />
            </a>
          </div>
          <div class="right">
            <a
              href="#"
              class="item"
              v-for="item in shoppingList"
              :key="item.id"
            >
              <div class="img">
                <img :src="item.src" alt="" />
              </div>
              <div class="title">{{item.title}}</div>
              <div class="desc">{{item.desc}}</div>
              <div class="price">
                <span>{{item.price}}起</span>
                <span v-if="item.oldPrice" class="oldPrice"
                  >{{item.oldPrice}}元</span
                >
              </div>
            </a>
          </div>
        </div>
      </div>
    </div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>
      // 199010120 唐梓铭
      const { createApp } = Vue;
      // 创建app
      const app = createApp({
        data() {
          return {
            shoppingList: [
              {
                id: 1,
                title: "Redmi K50 电竞版",
                desc: "全线拉满的冷血旗舰",
                src: "./imgs/phone1.png",
                price: 3299,
              },
              {
                id: 2,
                title: "Xiaomi 12 Pro",
                desc: "全新晓龙8 | 2K AMOLED屏幕",
                src: "./imgs/phone2.png",
                price: 3299,
              },
              {
                id: 3,
                title: "Xiaomi 12",
                desc: "全新晓龙8 | 5000万主摄",
                src: "./imgs/phone3.png",
                price: 3299,
              },
              {
                id: 4,
                title: "Xiaomi 12X",
                desc: "晓龙870 | 5000万主摄",
                src: "./imgs/phone4.png",
                price: 3299,
              },
              {
                id: 5,
                title: "Xiaomi 11 青春活力版",
                desc: "轻薄5G 内外皆出彩",
                src: "./imgs/phone5.png",
                price: 3299,
                oldPrice: 1999,
              },
              {
                id: 6,
                title: "Redmi Note 11 Pro 系列",
                desc: "三星AMOLED高刷屏",
                src: "./imgs/phone6.png",
                price: 3299,
              },
              {
                id: 7,
                title: "Redmi Note 11 5G",
                desc: "5000mAh大电量",
                src: "./imgs/phone7.png",
                price: 3299,
              },
              {
                id: 8,
                title: "Redmi Note 11 4G",
                desc: "5000mAh大电量",
                src: "./imgs/phone8.png",
                price: 3299,
                oldPrice: 999,
              },
            ],
          };
        },
      });
      // 挂载
      app.mount("#app");
    </script>
  </body>
</html>
